<template>
  <el-container class="home-container">
    <el-header>
      <div class="left">
        <i class="el-icon-menu"></i>
        <span>签名墙管理系统</span>
      </div>
      <div class="right">
        <i class="el-icon-user">
          <p>admin</p>
          <div class="box">
            <el-button @click="exit()">退出</el-button>
          </div>
        </i>
      </div>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu
          background-color="#545c64"
          text-color="#fff"
          unique-opened
          router
          active-text-color="#ffd04b"
          :default-active="$route.path"
        >
          <el-menu-item index="/user">
            <i class="el-icon-document"></i>
            <span slot="title">用户列表</span>
          </el-menu-item>
          <el-menu-item index="/showname">
            <i class="el-icon-setting"></i>
            <span slot="title">签名列表</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {};
  },
  methods: {
    exit() {
      this.$router.push("/login");
      localStorage.removeItem("token");
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.home-container {
  height: 100%;
}
.el-header {
  background-color: #373d41;
  padding-left: 0;
  align-items: center;
  color: #fff;
  font-size: 20px;
}
.left {
  margin-left: 10px;
  margin-top: 20px;
}
.right {
  float: right;
}
.right .box {
  display: none;
}
.right:hover .box {
  display: block;
  margin-left: 100px;
  margin-top: -45px;
}
.el-icon-user {
  margin-top: -30px;
  margin-right: 20px;
}
p {
  margin-top: -20px;
  margin-left: 20px;
}
.el-header div {
  display: flex;
  align-items: center;
}
.el-header div span {
  margin-left: 15px;
}
.el-aside {
  background-color: #333744;
}
.el-aside .el-menu {
  border-right: none;
}
.el-main {
  background-color: #eaedf1;
  padding: 0px;
}
.iconfont {
  margin-right: 10px;
}
.toggle-color {
  background-color: #4a5064;
  font-size: 10px;
  text-align: center;
  color: #fff;
  letter-spacing: 0.2em;
}
</style>
